//
//  HWShouYouCollectionViewCell.m
//  94hwanGame
//
//  Created by Chendaobin on 2019/8/22.
//  Copyright © 2019年 王治庭. All rights reserved.
//

#import "HWShouYouCollectionViewCell.h"

@interface HWShouYouCollectionViewCell()

@property (weak, nonatomic) IBOutlet UIImageView *picTureImageView;
@property (weak, nonatomic) IBOutlet UIView *beijingView;
@property (weak, nonatomic) IBOutlet UILabel *name1Label;
@property (weak, nonatomic) IBOutlet UILabel *name2Label;
@property (weak, nonatomic) IBOutlet UIButton *anZhuanBut;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *icolab;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *dierge;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *sangelay;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *silayout;

@end

@implementation HWShouYouCollectionViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
//    self.icolab.constant = 7*CFLScaleValue;
//    self.dierge.constant =6*CFLScaleValue;
//    self.sangelay.constant = 6*CFLScaleValue;
//    self.silayout.constant = 6*CFLScaleValue;
    self.anZhuanBut.userInteractionEnabled = NO;
    [self.anZhuanBut addTarget:self action:@selector(anZhuantap) forControlEvents:UIControlEventTouchUpInside];
    
    
    
    // Initialization code
    self.picTureImageView.layer.borderWidth = 5;
    self.picTureImageView.layer.borderColor = RGB(239, 136, 52).CGColor;
    self.picTureImageView.layer.cornerRadius = 10;
    self.picTureImageView.layer.masksToBounds = YES;
    
    self.beijingView.layer.cornerRadius = 10;
    self.beijingView.layer.masksToBounds = YES;
    
    
    self.anZhuanBut.layer.cornerRadius = 10;
    self.anZhuanBut.layer.masksToBounds = YES;
    self.anZhuanBut.backgroundColor = RGB(239, 136, 52);
    
    
    // 这里面
  // 第一种   RGB(255, 178, 50) RGB(239, 136, 52)
  // 第二种   RGB(254, 83, 37) RGB(236, 53, 11)
  // 第三种   RGB(38, 154, 255) RGB(26, 113, 255)
  // 第四种   RGB(45, 179, 57) RGB(22, 157, 34)

}

- (void)setIndex:(NSIndexPath *)index {
    
    _index = index ;
    NSInteger row = index.row;
    NSInteger  duoshao =  row%4 ;
    if (duoshao == 0 ) {
        
      self.beijingView.backgroundColor = RGB(255, 178, 50);
      self.picTureImageView.layer.borderColor = RGB(239, 136, 52).CGColor;
     self.anZhuanBut.backgroundColor = RGB(239, 136, 52);
        
        
    } else if (duoshao == 1) {
        
        self.beijingView.backgroundColor = RGB(254, 83, 37);
        self.picTureImageView.layer.borderColor = RGB(236, 53, 11).CGColor;
        self.anZhuanBut.backgroundColor = RGB(236, 53, 11);
        
        
    } else if (duoshao == 2) {
        
        self.beijingView.backgroundColor = RGB(38, 154, 255);
        self.picTureImageView.layer.borderColor = RGB(26, 113, 255).CGColor;
        self.anZhuanBut.backgroundColor = RGB(26, 113, 255);
        
        
    }else if (duoshao == 3) {
        
        
        self.beijingView.backgroundColor = RGB(45, 179, 57);
        self.picTureImageView.layer.borderColor = RGB(22, 157, 34).CGColor;
        self.anZhuanBut.backgroundColor = RGB(22, 157, 34);
        
        
    }
    
    

}


-(void)setModel:(HWJingPingModel *)model {

    _model  = model ;
    NSURL *urlStr = [NSURL URLWithString:model.icon];
    [self.picTureImageView sd_setImageWithURL:urlStr placeholderImage:nil];
    self.name1Label.text = [NSString stringWithFormat:@"%@",model.name];
    self.name2Label.text = [NSString stringWithFormat:@"%@",model.type];
    
    
    if ([model.system_type isEqualToString:@"1"]) {
        NSString *dakai  = [HWjianzhiduiObject keylocalization:@"查看"];
        
      //    [self.anZhuanBut setTitle:@"查看" forState:UIControlStateNormal];
        [self.anZhuanBut setTitle:dakai forState:UIControlStateNormal];
     } else {
         
         NSString *dakai  = [HWjianzhiduiObject keylocalization:@"查看"];
         //  [self.anZhuanBut setTitle:@"打开" forState:UIControlStateNormal];
         [self.anZhuanBut setTitle:dakai forState:UIControlStateNormal];
         
         
     }

}


#pragma mark ---------- 点击安装按钮

- (void)anZhuantap {
    DLog(@"点击安装按钮");
    
    
    
    
}

@end
